/*
 * Copyright (c) 2018.
 * http://www.ulabcare.com
 */

package com.mt.roll.passport.params;

import com.mt.roll.core.enums.AppTypeEnum;
import com.mt.roll.core.enums.UserTypeEnum;
import com.mt.roll.core.base.BaseParam;
import com.mt.roll.core.validator.constraints.Enum;
import com.mt.roll.passport.validator.groups.WechatLoginGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author jiff
 * @date 2018/11/13
 * @since 1.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@ApiModel("登录请求对象")
public class LoginParam extends BaseParam {
    @ApiModelProperty(value = "应用类型：\n" +
            "1、\tpc\n" +
            "2、\tapp\n" +
            "3、\twechat\n" +
            "4、\tminiapp", required = true, example = "1")
    @Enum(message = "非法的应用类型", target = {AppTypeEnum.class})
    @NotNull(message = "应用类型不能为空")
    private int appType;


    @ApiModelProperty(value = "用户类型：\n" +
            "1、\t平台\n" +
            "2、\t合作伙伴\n" +
            "3、\t医院\n" +
            "4、\t用户", required = true, example = "1")
    @Enum(message = "非法的用户类型", target = {UserTypeEnum.class})
    @NotNull(message = "用户类型不能为空")
    private Integer userType;


    @ApiModelProperty(value = "用户名", required = true, example = "13588441519")
    private String mobile;

    @ApiModelProperty(value = "密码", required = true, example = "123456")
    private String password;

    @ApiModelProperty(value = "微信APPID", required = false, example = "13588441519")
    @NotBlank(message = "微信APPID不能为空", groups = {WechatLoginGroup.class})
    private String wechatAppId;
    @ApiModelProperty(value = "微信OAuthCode，用户获取微信用户openid", required = false, example = "13588441519")
    private String oauthCode;

    @ApiModelProperty(value = "openId", required = true, example = "13588441519")
    @NotBlank(message = "openId", groups = {WechatLoginGroup.class})
    private String openId;
}
